package com.dao.impl;

import com.dao.BaseDao;

import com.dao.intf.SearchDao;
import com.entity.Blog;
import com.entity.User;

import java.util.List;

public class SearchDaoImpl extends BaseDao implements SearchDao {
    @Override
    public List<User> searchUser(String searchContent) {
        String sql="SELECT * FROM `user` WHERE `username` LIKE '%"+searchContent.trim()+"%' AND `isFreezed`=0 AND `role`='user' ";


        return queryForList(User.class,sql);
    }

    @Override
    public List<Blog> searchBlog(String searchContent) {

        String sql="SELECT * FROM `blog` WHERE `content` LIKE  '%"+searchContent.trim()+"%'";
        return queryForList(Blog.class,sql);
    }
}
